Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

num2fraction

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

num2fraction

Convert number to fraction

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4M
decreased by-12.84%
Maintainers
1
Weekly downloads
 
Created

What is num2fraction?

The num2fraction npm package is designed to convert decimal numbers to their simplest fractional representation. This can be particularly useful in applications that require displaying numbers in a more human-readable form, such as in cooking recipes or mathematical education tools.

What are num2fraction's main functionalities?

Decimal to Fraction Conversion

This feature allows you to convert a decimal number to its simplest fractional form. The code sample demonstrates converting the decimal numbers 0.5 and 1.75 to their fractional representations, '1/2' and '7/4' respectively.

const num2fraction = require('num2fraction');
console.log(num2fraction(0.5)); // Outputs: '1/2'
console.log(num2fraction(1.75)); // Outputs: '7/4'

Other packages similar to num2fraction

Keywords

FAQs

Package last updated on 14 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc